From 9aa9953a4b922bf7ce095179efdf80f0c63b250a Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Fri, 16 Jul 2021 23:28:45 +0200
Subject: [PATCH] avoid dependency on linux headers

---
 compiler-rt/lib/builtins/clear_cache.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/builtins/clear_cache.c b/compiler-rt/lib/builtins/clear_cache.c
index 5a443dd..a83aaaa 100644
--- a/compiler-rt/lib/builtins/clear_cache.c
+++ b/compiler-rt/lib/builtins/clear_cache.c
@@ -47,8 +47,10 @@ uintptr_t GetCurrentProcess(void);
 #endif
 
 #if defined(__linux__) && defined(__riscv)
-// to get platform-specific syscall definitions
-#include <linux/unistd.h>
+#define SYS_RISCV_FLUSH_ICACHE_LOCAL 1UL
+#define SYS_RISCV_FLUSH_ICACHE_ALL   (SYS_RISCV_FLUSH_ICACHE_LOCAL)
+#define __NR_arch_specific_syscall 244
+#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)
 #endif
 
 // The compiler generates calls to __clear_cache() when creating
-- 
2.32.0

